<div ng-controller="GnDashboardWfsIndexingController" class="wfs-indexing-dashboard">
  <div>
    <div class="row">
        <div class="col-md-12">
          <h1 translate>wfsIndexingTitle</h1>
          <p class="text-muted" translate>
              wfsIndexingSubtitle
          </p>
        </div>
      </div>
    </div>

    <div class="row">
      <div class="col-md-12 flex-row flex-end">
        <button type="button" class="btn btn-primary" ng-click="refreshJobList()">
          <i class="fa fa-refresh"/>&nbsp;
          <span translate>refresh</span>
        </button>
      </div>
    </div>

    <div ng-if="loading" class="row">
      <br /><br /><br /><br />
      <div class="flex-row flex-center">
        <i class="fa fa-spinner fa-spin"/>
      </div>
    </div>

    <div ng-if="error" class="row">
      <div class="alert alert-danger" role="alert">
        <i class="fa fa-exclamation-triangle" />
        <span translate>wfsIndexingRefreshError</span>
        <span>{{error}}</span>
      </div>
    </div>

    <div class="jobs-list" ng-if="!loading && !error">
      <div ng-repeat="job in jobs" class="row">
        <div class="panel panel-default col-md-12">
          <dl class="dl-horizontal panel-body">
            <dt translate>wfsurl</dt>
            <dd><a href="{{job.url}}">{{job.url}}</a> - <a href="{{job.url | asGetCapabilities:'WFS'}}">GetCapabilities</a></dd>

            <dt translate>status</dt>
            <dd><span class="label" ng-class="'label-' + getLabelClass(job.status)">{{job.status}}</span></dd>

            <dt translate>wfsIndexingFeatureType</dt>
            <dd>{{job.featureType}}</dd>

            <dt translate>featureCount</dt>
            <dd>{{job.featureCount}}</dd>

            <dt translate>wfsIndexingMetadataUuid</dt>
            <dd><code>{{job.mdUuid}}</code></dd>

            <div ng-if="job.mdUuid">
              <dt translate>wfsIndexingMetadata</dt>
              <dd>
                <span ng-if="job.md.error">
                  <span translate>{{job.md.error}}</span>
                </span>
                <span ng-if="job.md && !job.md.error">
                  <a href="catalog.search#/metadata/{{job.md.getUuid()}}" translate>{{job.md.title}}</a>
                </span>
                <i ng-if="!job.md" class="fa fa-spinner fa-spin"/>
              </dd>
            </div>

            <div ng-if="job.error" class="text-danger">
              <dt translate>wfsIndexingError</dt>
              <dd>{{job.error}}</dd>
            </div>
          </dl>
        </div>
      </div>
    </div>
  </div>
</div>
